#include "common.h"
#include "main.h"

// This application instance is required or the app will not run
MangoFishApp applicationInstance; 

// Constructor
MangoFishApp::MangoFishApp() {}

// Destructor
MangoFishApp::~MangoFishApp() {}

int MangoFishApp::main(int, char **) {

	// Create a console window for text-output if not available
	CL_ConsoleWindow console("Mango Fish Console");
	console.redirect_stdio();

	try	{
		// CL initialization functions
		// These must be called or CL functions will not work
		// Also, SetupCore must be init()'ed first and denit()'ed last
		CL_SetupCore::init();
		CL_SetupDisplay::init();
		CL_SetupGL::init();

		MangoFishGame myGame;
		myGame.run();

		// CL deinitialization functions
	} 
	catch (CL_Error err) {
		std::cout << "Exception caught: " << err.message.c_str() << std::endl;

		// Display console close message and wait for a key
		console.display_close_message();
	}
	return 0;
}
